<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript" src="/portal/js/common.js"></script>
<script type="text/javascript" src="/portal/js/date.js"></script>
<netui-template:template templatePage="/com/ansteel/security/template/titletemp.jsp">
	<netui-template:section name="main">


<script type="text/javascript">
		var  sum=10;

function localDate(strDate)
{
	var str=strDate.split("-");
	
	//2009-10-10
	var strYear=str[0];
	var strMonth=str[1];
	
	var sdate=new Date();
	var sYear=sdate.getFullYear();
	var sMonth=sdate.getMonth()+1;
	 
	if(strYear==sYear&&sMonth==strMonth){
	
		return true;
	}else{
		return false;
	}
	

}
function validateForm(label)
{
	  
	
	if(!checkIsNotEmpty(document.getElementById("actionForm_time").value)){
		alert("评价时间不能为空!");
		document.getElementById("actionForm_time").focus();
		return false;
	}
	if(!checkIsValidDate(document.getElementById("actionForm_time").value)){
		alert("评价时间不是正确的日期格式");
		document.getElementById("actionForm_time").focus();
		return false;
	}
	if(!localDate(document.getElementById("actionForm_time").value)){
		alert("日期不是本年或本月内的，不允许录入");
		document.getElementById("actionForm_time").focus();
		return false;
	}
	if(!checkIsNotEmpty(document.getElementById("actionForm_organName").value)){
		alert("班组名称不能为空!");
		document.getElementById("actionForm_organName").focus();
		return false;
	}
	
	
	if(label==1){
	var rows = tb.rows;
	for(i=1;i<rows.length;i++)
	{
	
	 
    if( document.getElementById("factoryScoreDepict"+(i-1)).value.length>=200){
		alert("评价原因描述长度过长，最大为200 ");
       	 return false;
	}		
    if(document.getElementById("remark"+(i-1)).value.length>=200){
		 alert("说明描述长度过长，最大为200 ");
       	 return false;
	}
		if(document.getElementById("factoryPenalized"+(i-1)).value.length==0 && document.getElementById("factoryScoreDepict"+(i-1)).value.length==0
		&&document.getElementById("remark"+(i-1)).value.length==0
		)continue;
		
		//检查是否数字
    var txt = document.getElementById("factoryPenalized"+(i-1)).value;
    if(txt.search("^(-|\\+)?\\d+(\\.\\d+)?$")!=0){        
        alert("第"+i+"行厂评分不是数字"); 
        return false;
    }
		 
		if(document.getElementById("factoryScoreDepict"+(i-1)).value.length==0){alert("第"+i+"行厂评价原因不能为空");return false;}
		 
	}
	}else if(label==0){
	var rows = tb.rows;
	for(i=1;i<rows.length;i++)
	{
	 
    if( document.getElementById("workareaScoreDepict"+(i-1)).value.length>=200){
		alert("评价原因描述长度过长，最大为200 ");
       	 return false;
	}		
    if(document.getElementById("remark"+(i-1)).value.length>=200){
		 alert("说明描述长度过长，最大为200 ");
       	 return false;
	}
		if(document.getElementById("workareaPenalized"+(i-1)).value.length==0 && document.getElementById("workareaScoreDepict"+(i-1)).value.length==0
		&&document.getElementById("remark"+(i-1)).value.length==0
		)continue;
		if(document.getElementById("workareaScoreDepict"+(i-1)).value.length==0){alert("第"+i+"行班自评评分原因不能为空");return false;}
		 
		 	//检查是否数字
    	var txt = document.getElementById("workareaPenalized"+(i-1)).value;
    	if(txt.search("^(-|\\+)?\\d+(\\.\\d+)?$")!=0){        
       	 alert("第"+i+"行班组评分不是数字");
       	 return false;
    	} 
	}
	}else{
		alert("有异常，请重新访问本页面");
		return false;
	}
	   
	return true;
}

</script>
 
		<netui:errors />
		<netui:form action="createSecuRedflagDetailGroupSubmit">
			<TABLE border=0 cellSpacing=0 cellPadding=0 width=960>
				<TBODY>
					<TR>
						<div class="clumnTop"><img src="${pageContext.request.contextPath}/images/SafeImages/loginImg_1.gif" />当前位置&gt;&gt;
						 班组评价录入<span> </span></div>
					</TR>
				</TBODY>
			</TABLE>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr height="28">
					<td width="10%" align="center" bgcolor="#F5F5F5"><span class="redStar">*</span>时&nbsp;&nbsp;&nbsp;间</td>
					<td width="20%" bgcolor="#F5F5F5">
					<netui:textBox dataSource="actionForm.time" onfocus="calendar()"
						tagId="actionForm_time">
						<netui:formatDate pattern="yyyy-MM-dd" />
					</netui:textBox></td>
					<td width="10%" bgcolor="#F5F5F5"><span class="redStar">*</span>班&nbsp;&nbsp;&nbsp;组</td>
					<td width="20%" bgcolor="#F5F5F5">
					
					<!-- 厂的显示树 -->
					<c:if test="${actionForm.userisWorkOrPro==1}">
					<netui:hidden dataSource="actionForm.groupName" tagId="actionForm_organId" />
					<netui:textBox dataSource="actionForm.groupShowGroupName" tagId="actionForm_organName" readonly="true" /> <netui:button
						type="submit" value="…" action="chooseOrganId" popup="true">
						<netui:configurePopup location="false" width="300" height="450" scrollbars="true">
							<netui:retrievePopupOutput dataSource="outputFormBean.sysOrganSearch.organId" tagIdRef="actionForm_organId" />
							<netui:retrievePopupOutput dataSource="outputFormBean.sysOrganSearch.organName" tagIdRef="actionForm_organName" />
						</netui:configurePopup>
					</netui:button>
					</c:if>
					<!-- 作业区显示名称 pageFlow -->
					 <c:if test="${actionForm.userisWorkOrPro!=1}">
					 <netui:select 
						dataSource="actionForm.groupName" 
						tagId="actionForm_organName"
						optionsDataSource="${actionForm.organsMapForm}"  
						nullableOptionText="false">
					</netui:select>
					 </c:if>
					</td>
					
					<td bgcolor="#F5F5F5">
					<netui:button value="保存" action="createSecuRedflagDetailGroupSave"
					onClick="return validateForm(${actionForm.userisWorkOrPro});" /></td>
					
					<c:if test="${actionForm.userisWorkOrPro==1}">
					<td bgcolor="#F5F5F5"><netui:button value="提交"
						onClick="return validateForm(${actionForm.userisWorkOrPro});" />
					</td>
					</c:if>
					<td bgcolor="#F5F5F5"><netui:button value="取消" action="begin" /></td>
					<td bgcolor="#F5F5F5" width="20%">&nbsp;</td>
				</tr>
			</table>



			<table width="100%" cellpadding="0" cellspacing="0" border="0" id="tb">
				<tr height="25" class="tableBorder">
					
					<th background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong><span class="redStar">*</span><netui:label
						for="actionForm_secuRedflagDetails_workareaScoreDepict" value="班组/作业区评价原因" /></strong></th>
					<th background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong><span class="redStar">*</span><netui:label
						for="actionForm_secuRedflagDetails_workareaPenalized" value="班组/作业区评分" /></strong></th>
					
					<th background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong><span class="redStar">*</span><netui:label
						for="actionForm_secuRedflagDetails_factoryScoreDepict" value="厂/公司评价原因" /></strong></th>
					<th background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong><span class="redStar">*</span><netui:label
						for="actionForm_secuRedflagDetails_factoryPenalized" value="厂/公司评分" /></strong></th>
					<th background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong><netui:label
						for="actionForm_secuRedflagDetails_remark" value="说明" /></strong></th>
				</tr>

				<c:if test="${actionForm.userisWorkOrPro==1}">
					<netui-data:repeater dataSource="actionForm.secuRedflagDetails">
						<tr valign="top">
							
							<td bgcolor="#F5F5F5" align="center"><netui:textBox dataSource="container.item.workareaScoreDepict"
								tagId="workareaScoreDepict${container.index}" disabled="true" size="35">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.workareaPenalized"
								tagId="workareaPenalized${container.index}" size="20" disabled="true">
							</netui:textBox></td>
							
							<td bgcolor="#F5F5F5" align="center"><netui:textBox dataSource="container.item.factoryScoreDepict"
								tagId="factoryScoreDepict${container.index}" size="35">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.factoryPenalized"
								tagId="factoryPenalized${container.index}" size="20">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.remark"
								tagId="remark${container.index}" size="35">
							</netui:textBox></td>
						</tr>
					</netui-data:repeater>
				</c:if>
				<c:if test="${actionForm.userisWorkOrPro!=1}">
					<netui-data:repeater dataSource="actionForm.secuRedflagDetails">
						<tr valign="top">
							
							<td bgcolor="#F5F5F5" align="center"><netui:textBox dataSource="container.item.workareaScoreDepict"
								tagId="workareaScoreDepict${container.index}" size="35">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.workareaPenalized"
								tagId="workareaPenalized${container.index}" size="20">
							</netui:textBox></td>
							
							<td bgcolor="#F5F5F5" align="center"><netui:textBox dataSource="container.item.factoryScoreDepict"
								tagId="factoryScoreDepict${container.index}" disabled="true" size="35">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.factoryPenalized"
								tagId="factoryPenalized${container.index}" size="20" disabled="true">
							</netui:textBox></td>
							<td bgcolor="#ECECEC" align="center"><netui:textBox dataSource="container.item.remark"
								tagId="remark${container.index}" size="35">
							</netui:textBox></td>
						</tr>
					</netui-data:repeater>

				</c:if>
				<tr>					
					
					<td background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong>&nbsp;</strong></td>
					<td background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong>&nbsp;</strong></td>
					<td background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong>&nbsp;</strong></td>
					<td background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif"><strong>&nbsp;</strong></td>
					<td background="${pageContext.request.contextPath}/images/SafeImages/tableImg_1.gif" align="right">
					&nbsp;&nbsp;&nbsp;&nbsp; 
						<netui:button action="addRgRow" type="submit" value="添加空白行"/>
						</td>
					
				</tr>
			</table> 
		</netui:form>

		<a href="/portal/com/ansteel/security/cms/redFlag/redFlagDetailGroup/web/searchSecuRedflagHead.do">返回 安全标准化班组首页</a>
		<!-- 页脚 -->
 
	</netui-template:section>

</netui-template:template>